home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / ViewIt™ Shareware.sea / ViewIt™ 2.04 Shareware / FaceWare.rsrc / TEXT_1280_U7. Strings.txt < prev    next >
Text File  |  1992-08-15  |  6KB  |  72 lines

  1. U7. Strings
  2.   UtilIt supports several commands that perform common string-related operations:  setting substrings, trimming strings, setting parameter text, converting strings from one format to another, finding strings within text blocks, and interconverting strings and numbers.
  3.  
  4. SetSub  451  a,b,c,d,uString,uName
  5.   Moves the contents of uString into uName beginning at character a of uName and ending at character b (i.e. sets a substring in uName).  Undefined characters are replaced with spaces so that SetSub works even if uName is less than b characters in length, or uString is smaller than the substring.  You can optionally use parameter c to pass the address of a Pascal-type source string (instead of using uString), and/or d to pass the address of a Pascal-type destination string (instead of using uName).
  6.   NOTE:  You can get substrings using the command GetStr described in the "String Lists" topic.
  7.  
  8. TrmStr  452  a,b,uString,uName
  9.   Moves or removes leading or trailing spaces within the string uString, uName, or some other string designated by a, according to the type of adjustment specified by b.
  10.   a = string to adjust
  11.     0 or 1 = uString
  12.     2 = uName
  13.     other = address of a Pascal string
  14.   b = type of adjustment to make
  15.     1 = removes (trims) trailing spaces
  16.     0 = removes both leading and trailing spaces
  17.    -1 = removes leading spaces
  18.    -2 = moves leading spaces to end of string
  19.  
  20. SetPrm  453  a,b,c,d,uString
  21.   Resets the four parameter text strings (^0, ^1, ^2, and ^3 items in dialogs and alerts) to the strings designated by a, b, c, and d where,
  22.   0 = empty string
  23.   1 to 255 = size of substring from uString
  24.   other = address of a Pascal string
  25. If using substrings from uString, these are obtained in succession, and trimmed of both leading and trailing spaces before being assigned to parameter text.  For example, the call "FaceIt(nil,SetPrm,10,20,10,30)" would set the ^0 item to the first 10 characters of uString, ^1 to the next 20 characters, ^2 to the next 10 characters, ^3 to the next 30 characters (= 70 total characters of uString used).  This approach can be mixed with that of passing Pascal string addresses.  SetPrm is primarily provided for those programmers who do not have access to the toolbox routine ParamText, but is also useful when "writing" multiple parameter text items to a single string.
  26. NOTE:  This command is largely obsolete now since the basic control driver used with ViewIt provides a more powerful "parameter text" scheme based on the use of string lists.
  27.  
  28. CnvStr  454  a,b,c,d,uString,uName
  29.   Converts the string designated by parameter c from string type a to type b.  Parameter d designates the total number of bytes occupied by the string variable (its "storage size") which is usually larger than the number of characters in the string (the "string length").
  30.   a = source type (0 = Pascal, 1 = C, 2 = Fortran)
  31.   b = converted type (0 = Pascal, 1 = C, 2 = Fortran)
  32.   c = source string (0 or 1 = uString, 2 = uName, other = string address)
  33.   d = source string storage size (0 ‚⧠d ‚⧠256 bytes)
  34.       (if d = 0, UtilIt assumes d = 256 bytes)
  35.  
  36. FndTxt  455  a,b,c,d,uResult
  37.   Searches within the text block defined by a and b for the string defined by c and d.  Note that the text block must be locked in memory during the search since FndTxt can move heap memory.  uResult returns the position of the found string as a byte offset from a, or -1 if not found.
  38.   a = address of text block to search
  39.   b = size of text block to search (bytes)
  40.   c = address of search text
  41.   d = size of search text (use -d for case sensitive search)
  42.  
  43. NumToS  471  a,b,c,d,uString
  44.   Converts a number from the variable designated by b to the string designated by a, using the format indicated by c and d.  Infinities will appear as the character "‚àû".
  45.   a = destination string
  46.     0 = uString
  47.     other = address of a Pascal string
  48.   b = source of number (as a data type)
  49.     1 = uI1    5 = uR4
  50.     2 = uI2    6 = uR8
  51.     3 = uI4    7 = uR10
  52.     4 = uI8    8 or 12 = uR12  (12 = THINK C "universal")
  53.   c = format
  54.     0 = general (= fixed point unless very large or small)
  55.     1 = floating point
  56.     2 = fixed point
  57.   d = digits (use -d to also trim trailing decimal zeroes)
  58.     if c = 0 or 1, d = significant figures (-4 used if d = 0)
  59.     if c = 2, d = decimals to display
  60.  
  61. SToNum  481  a,b,uString,uResult,fI1Err...
  62.   Converts a string designated by a to an integer or real number in the variable designated by b.  The "‚àû" character can be used in strings to represent infinities.  Leading and trailing spaces are ignored.
  63.   a = source string
  64.     0 = uString
  65.     other = address of a Pascal string
  66.   b = destination variable (as a data type)
  67.     1 = uI1    5 = uR4
  68.     2 = uI2    6 = uR8
  69.     3 = uI4    7 = uR10
  70.     4 = uI8    8 or 12 = uR12  (12 = THINK C "universal")
  71. If no error occurs, then uResult is set equal to zero, else uResult returns with a value less than zero and the variable (uI1...uR12) is set equal to the corresponding error value in fRec (fI1Err..fR12Err).  The default error values are zero, but these can be changed at any time to other values if you prefer a special non-zero value to be returned when an error occurs.
  72.   Conditions causing an error include an empty string or a string that cannot be evaluated as a number (an NAN).  A number that is out of the range of values represented by the destination variable's numerical type is either set equal to the maximum or minimum integer (for integer types), or to ¬±‚àû or 0 (for real types).